<include file="public@header" />
</head>
<body>
<style type="text/css">
	.aui_state_lock{
		top:50% !important;
		left: 50% !important;
		transform: translate(-50%,-50%);
	}
</style>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
	
			<li class="active" id="list"><a href="{:url('Wxstaff/index')}">员工列表</a></li>
		<!-- 	<li><a href="{:url('order/addorder')}">添加</a></li> -->
			<!-- 	<li><a href="{:url('user/add')}">{:lang('ADMIN_USER_ADD')}</a></li> -->
		</ul>
        <button type="button" class="btn btn-default search-switch" style="float:right;margin:10px 0" aria-label="Left Align">
            <span class="glyphicon glyphicon-list" aria-hidden="true"></span>按条件查询
        </button>
		<form class="well form-inline search-form" style="overflow:hidden;clear:right;display:none;"  method="post" action="{:url('Wxstaff/index')}">
		    员工名称:
			<input type="text" class="form-control" name="staff_name" style="width: 140px;" value="{:session('staff_name')}" placeholder="请输入员工名称">
			<!-- 业务员名称:
			<input type="text" class="form-control" name="salesname" style="width: 140px;" value="" placeholder="请输入业务员名称"> -->
			<!-- 企业名称:
			<input type="text" class="form-control" name="commpany_name" style="width: 140px;" value="" placeholder="请输入业务员名称"> -->
			客户名称:
			<input type="text" class="form-control" name="customer_name" style="width: 140px;" value="{:session('customer_name')}" placeholder="请输入客户名称">
				审核状态:
			<select class="form-control" name="apply_member" style="width: 140px;">
				<option value='0' >请选择</option>
				<option value="3" <if condition="$apply_member eq 3">selected</if>>审核中</option>
				<option value="1" <if condition="$apply_member eq 1">selected</if>>审核通过</option>
				<option value="2" <if condition="$apply_member eq 2">selected</if>>审核失败</option>
				


			</select> &nbsp;&nbsp;	
			<!-- <br/><br/>
			时间:
			<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
			value="{$start_time|default=''}"
			style="width: 140px;" autocomplete="off">-
			<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
			value="{$end_time|default=''}"
			style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;  -->
			



			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="{:url('Wxstaff/index')}">清空</a>
		</form>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th width="25%">公司</th>
					<th width="5%">员工信息</th>
					<th width="5%">员工名片</th>
				<!-- 	<th width="5%">员工权限</th> -->
					<th width="20%">操作</th>
				</tr>
			</thead>
			<tbody>
				
				
				<foreach name="list" item="vo" key="k">
					<tr>
						<td> <?php echo get_customer_name($vo['customer_id']); ?></td>
						<td>{$vo.staff_name}{$vo.staff_phone}{$vo.app_position}</td>
				
					<!-- 	<td>
							<a href="javascript:parent.imagePreviewDialog('{$vo['business_card']}');">
							<i class="fa fa-photo fa-fw"></i>
						</a>

							
						</td> -->
							<td><!-- <div><a href="{$vo['business_card']}"><img src="{$vo['business_card']}" style="width:70px;display:block;"/></a></div> -->
							<a href="javascript:parent.imagePreviewDialog('{$vo['business_card']}');">
							<img src="{$vo['business_card']}" style="width:30px;height:30px;display:block;"/>
							</a>

						<!-- <td><if condition="$vo['staff_type'] eq 1">最高权限员工<else/>普通员工</if></td> -->
						<td>
						<!-- 	<a class='edit' href='{:url('Order/editOrder',array('id'=>$vo.id))}'>编辑</a> -->
							
					<!-- 		<if condition="$vo['apply_member'] eq 2">
							
							<a class='add_audit' id="{$vo['id']}">通过</a>
							<elseif condition="$vo['apply_member'] eq 3">
							<a class='add_audit' id="{$vo['id']}">通过</a>
							<else/>
							<a class='add_cancel_audit' id="{$vo['id']}">拒绝</a>
							</if> -->
							<if condition="$vo['apply_member'] eq 3">
							<a class='add_audit' id="{$vo['id']}">通过</a>
							<a class='add_cancel_audit' id="{$vo['id']}">拒绝</a>
							</if>
						<!-- 	|
							<if condition="$vo['is_use'] eq 2">
							
							<a class='cancel_del' id="{$vo.id}">取消禁用</a>
							<else />
							
							<a class='del' id="{$vo.id}">禁用</a>
							</if> -->
						</td>
					</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>
<script>
	$(function(){
		stime="{$stime}";
		etime="{$etime}";
		cusname="1";
		spacname="2";
		commpany_name="3";
		salesman="2";
		if(spacname){
			$("input[name=space_name]").val(spacname);
		}
		if(salesman){
			$("input[name=salesname").val(salesman);
		}
		// if(cusname){
		// 	$("input[name=customer_name]").val(cusname);
		// }
		//alert(commpany_name);
		if(commpany_name){
			$("input[name=commpany_name]").val(commpany_name);
		}
		if(stime){
			$("input[name=start_time]").val(stime);
		}
		if(etime){
			$("input[name=end_time]").val(etime);
		}
	})
    $('.search-switch').click(function(){
        $('.search-form').toggle();        
    })
	$(".add_audit").click(function(){
		id=$(this).attr("id");
			if(confirm("是否确定改员工具有预定会议室权限？")){
				 $.post("{:url('Wxstaff/add_audit')}",{id:id,cancel:1},function(data,status){
				 
				 	alert('权限添加成功');	
				 	//$("input[name=deposit_price]").val('0.00');
				 	location.href="{:url('index',array('wx_secrect'=>session('wx_secrect')))}";
				 })
			}
		
		   })	
	$(".add_cancel_audit").click(function(){
		id=$(this).attr("id");
			if(confirm("是否确定取消该员工预定会议室权限？")){
				 $.post("{:url('Wxstaff/add_audit')}",{id:id,cancel:2},function(data,status){
				
				 	alert('权限取消成功');	
				 	//$("input[name=deposit_price]").val('0.00');
				 	location.href="{:url('index',array('wx_secrect'=>session('wx_secrect')))}";
				 })
			}
		
		   })	
	$(".del").click(
	    function(){
	    if(confirm("确认要禁用吗")){
	    	    var id=$(this).attr("id");
	    	    $.post("{:url('forbade_staff')}",
	    		{id:id,cancel:1},
	    		function(data,status){

	    			location.href="{:url('index')}";
	    		});
	    }
		
		
	    }
	);
	$(".cancel_del").click(
	    function(){
	    if(confirm("确认要取消禁用吗")){
	    	    var id=$(this).attr("id");
	    	    $.post("{:url('forbade_staff')}",
	    		{id:id,cancel:2},
	    		function(data,status){

	    			location.href="{:url('index')}";
	    		});
	    }
		
		
	    }
	);




</script>
